Learning Objectives

After completing this lesson, you’ll be able to:

Instructions

In this lesson, you will:

Resources

Debugging

In this course, we’ll cover best practices for debugging your workspaces.

Even skilled FME users seldom produce new workspaces with zero defects. For that reason, all users must be aware of the debugging techniques available in FME.

Generally, debugging in FME consists of determining whether a problem has occurred and then tracking down the problem's source (for example, where it appears in the workspace). Once you have determined where a problem arises, you can investigate it.

There are various debugging techniques available in FME, and it's essential to use these in the correct order. For example, you shouldn't waste time randomly changing parameters and re-running the workspace when a simple log message explains the issue!

A logical order would be:

Note

In software development, debugging a process after completion is called "post-mortem debugging"! We're trying to find out what caused a fatality.

If we can't determine the cause by a post-mortem, we'll re-run the process with various tracing options turned on. We can call that "interactive debugging."

Log Interpretation

FME logs contain a record of all stages and processes within a translation. The contents are vital for debugging purposes.

Log Message Types

Different message types appear in the log window, including:

Note

The Log window is displayed as a table. The Transformer column shows you which transformer an error/information message is coming from. Click the hyperlinked transformer name to navigate to the canvas element producing the message. Using this link to identify where errors are occurring will make your debugging more efficient.

Spatial Log File

Besides writing the log to a text file (<workspace name>.log), FME also writes a spatial log:

Spatial log file

The spatial log is a dataset of features (in FME Feature Store format) that the log mentions. FME generates a spatial log from <Rejected> Features when Navigator > Workspace Parameters > Reader/Writer Redirect is enabled or when a Logger has Feature Logging set to "Log and Record." You can open the FFS dataset within FME Data Inspector or the Data Preview window in FME Workbench to inspect the features and identify any problems that caused FME to reject them.

Interpreting the Log Window

The Translation Log window should be the first place you check when a translation finishes. It will tell you if there are any concerning errors or warnings.

Errors

If an ERROR occurs, FME will likely stop the translation. There will be red text in the log and some statements such as:

Program Terminating
Translation FAILED.

There may be several ERROR messages, so scroll back up the log window and identify the first of these, which is the likely cause of the problem. For example, this message:

ERROR |Error connecting to PostgreSQL database(host='postgis.train.safe.com', port='5432', dbname='fmedata', user='fmedata', password='*'): 'FATAL: password authentication failed for user "fmedata" FATAL: password authentication failed for user "fmedata"

...is an obvious problem authenticating a database connection.

Warnings

Even when a translation succeeds, it's essential to check the log for the following comment:

Translation was SUCCESSFUL with X warning(s)

If there are any warnings (for example, if X > 0), use the search option to look for the word WARN. Any warning messages might significantly affect the quality of the output data.

Finding the Error's Source

Click the log hyperlink to look at the object on the canvas that produced the error.

Transformer link in log

Exercise

Frank

Frank is working on a workspace that reads address data from a File Geodatabase and writes it to a CSV with a new schema. He notices that text attributes containing Traditional Chinese characters are rendered incorrectly in the output. For example, the name "麥毅倫" appears as "???." He suspects a text encoding issue and needs to use his debugging skills at critical stages to determine when the data last looked correct.

In this exercise, you will:

1) Open and Run Starting Workspace

2) Inspect the Source Data Before Reading

It's easy to assume source data is correct without checking it. Before tracing the encoding problem in FME, confirm that the data looks correct in its native application.

Viewing encoding in ArcCatalog

3) Inspect the Source Data After Reading

Now confirm that FME reads the source data correctly. One of the features with a Chinese character value belongs to owner Marisa Marmol. You'll use her name to filter down to the problem feature.

Inspecting source data in FME

Viewing encoding in Visual Preview

4) Inspect the Data Before Writing

Now check whether the data is still correct after transformation and before writing.

Inspecting final cache

Viewing encoding before writing

5) Inspect the Output Dataset in Data Preview

Since the data is correct going into the writer, check whether the problem occurs during writing.

View Written Data button

6) Inspect the Output in a Text Editor

Opening the output file in a text editor is another useful check. It is not possible to do this for every dataset, such as binary files or databases, but text-based files can confirm whether the data is correct in the destination.

Viewing encoding in destination application

7) Inspect the Output Dataset in Another Application

Although not the case in our scenario, if the file appears correct in a text editor but still displays incorrectly in the destination application, the problem is likely with the application's interpretation of the encoding.

Viewing data in another application

Inspecting data at multiple stages helps you narrow down where an encoding problem occurs, but it does not always reveal the root cause. The problem could be a writer parameter set incorrectly, a limitation of the writer format, or a difference in how two applications interpret the same file. Once you know which stage introduced the error, you have a clear starting point for investigating why.

Tips and Tricks: Text Encoding in FME

Text encoding is a complex topic, so here is some useful background.

UTF-8 is the modern standard for text encoding because it supports all Unicode characters, including Traditional Chinese, Japanese, Arabic, and others. FME uses UTF-8 process encoding as of FME 2022.0. Before that, FME on Windows relied on the system's default ANSI encoding, which varied by regional settings (for example, Windows-1252 or Shift-JIS). UNIX-based systems have long used UTF-8 by default.

As of Windows 10 (version 1903) and Windows Server 2019, FME uses UTF-8 for encoding provided the system is configured to do so. This allows workspaces to be authored and run across different locales with consistent text output.

For more detail, see the UTF-8 Names FAQ.

Leave Us Feedback on This Lesson